import request from '@/utils/request'

// 港口管理
export function getAllPorts() {
    return request({
        url: '/api/port',
        method: 'get'
    })
}

export function getPortById(id) {
    return request({
        url: `/api/port/${id}`,
        method: 'get'
    })
}

export function addPort(data) {
    return request({
        url: '/api/port',
        method: 'post',
        data
    })
}

export function updatePort(data) {
    return request({
        url: '/api/port',
        method: 'put',
        data
    })
}

export function deletePort(id) {
    return request({
        url: `/api/port/${id}`,
        method: 'delete'
    })
}

// 港口规则和费用计算
export function getEffectiveRule(companyId, portId) {
    return request({
        url: `/api/port/rule/${companyId}/${portId}`,
        method: 'get'
    })
}

export function calculateStorageFee(data) {
    return request({
        url: '/api/port/calculate-fee',
        method: 'post',
        data
    })
} 